import java.util.ArrayList;


public class GlobalCollections {
	private SolutionStateList solutionPath;
	private static GlobalCollections globalCollections;
	private static StateList allGeneratedStates;
	private static SnapShotStack allGeneratedFwdStates;
	private static SnapShotStack allGeneratedBwdStates;
	private static SnapShotStack allGeneratedStatesNew;
	
	private static HashCollection bwdStates;
	private static HashCollection fwdStates;
	
	private GlobalCollections() {
		solutionPath            = new SolutionStateList();
		allGeneratedStates      = new StateList();
		//allGeneratedStatesNew 	= new SnapShotStack(); 
		//allGeneratedFwdStates   = new SnapShotStack();
		//allGeneratedBwdStates   = new SnapShotStack();
		
		fwdStates = new HashCollection();
		bwdStates = new HashCollection();
	}
	
	public static GlobalCollections getCollection() {
		if (globalCollections == null) globalCollections = new GlobalCollections();
		return globalCollections;
	}
	
	public static void reset() {
		globalCollections = new GlobalCollections();
	}
	
	public SolutionStateList getSolutionPath() {
		return solutionPath;
	}
	
	public StateList getAllGeneratedStates() {
		return allGeneratedStates;
	}
	
	public SnapShotStack getAllGeneratedStatesNew() {
		return allGeneratedStatesNew;
	}
	/*
	public SnapShotStack getAllGeneratedFwdStates() {
		return allGeneratedFwdStates;
	}
	
	public SnapShotStack getAllGeneratedBwdStates() {
		return allGeneratedBwdStates;
	}
	*/
	public void addGeneratedFwdState(BoardState state) {
		//allGeneratedFwdStates.addSnapshot(state);
		fwdStates.insert(state);
		allGeneratedStates.add(state);
		//allGeneratedStatesNew.addSnapshot(state);
		//g++;
		//System.out.println("GEN: " + g);
	}
	int g=0;
	public void addGeneratedBwdState(BoardState state) {
		//allGeneratedBwdStates.addSnapshot(state);
		allGeneratedStates.add(state);
		bwdStates.insert(state);
		//allGeneratedStatesNew.addSnapshot(state);
	}
	
	public HashCollection getBwdStates() {
		return bwdStates;
	}

	public static void setBwdStates(HashCollection bwdStates) {
		GlobalCollections.bwdStates = bwdStates;
	}

	public HashCollection getFwdStates() {
		return fwdStates;
	}

	public static void setFwdStates(HashCollection fwdStates) {
		GlobalCollections.fwdStates = fwdStates;
	}
}
